import requests
from lxml import html

def lofter_get_page_info(url_str):
    content={}
    page=html.fromstring(requests.get(url_str).text)
    try:
        content['title']=page.cssselect('title')[0].text
    except IndexError:
        content['title']=''
    content['img']=[]
    num=0
    if len(page.cssselect('.pic > a > img')) :
        for i in page.cssselect('.pic > a > img'):
            if num>8:
                continue
            else:
                content['img'].append(f"{ i.get('src').split('?')[0] }?imageView&thumbnail=1680x0")
                num +=1
    else:
        print(len(page.cssselect(' .img > a > img')))
        for i in page.cssselect('.img > a > img'):
            if num>8:
                continue
            else:
                content['img'].append(f"{ i.get('src').split('?')[0] }?imageView&thumbnail=1680x0")
                num +=1
    return content
